{extend name="public:base" /}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<link rel="stylesheet" type="text/css" href="__COMMON__/css/style.css">
{/block}

{block name="html"}
{include file="index@public/main" /}
<div class="right_style">
    <h3 class="title_style"><em></em><span>我的地址</span></h3>
<div class="shdz">
    <h1 class="h1">收货地址</h1>
    <ul>
        {volist name="list" id="v"}
            <li class="li_sc">
                <a href="#">
                    <i>姓名：{$v.name}</i><em>联系电话：{$v.phone}</em>
                    <p>地址：{$v.address}</p>
                </a>
                <div class="bjsc">
                    <a href='{:url("User/add_address",array("aid"=>$v.id))}'><i><img src="__INDEX__/img/bj.png"/></i>编辑</a>
                    <a class="sc" href="javascript:;" onclick="delAddressFuc('{$v.id}')"><i><img src="__INDEX__/img/sc.png"/></i>删除</a>
                </div>
            </li>
        {/volist}
    </ul>
    <a class="xzdz" href='{:url("User/add_address")}'>新增地址</a>
</div>
</div>
{/block}
{block name="javascript"}
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>

<script type="text/javascript">

    function delAddressFuc(id){
        layer.open({
            content: "确定要删除吗？"//
            ,yes: function(index, layero){
                $.ajax({
                    type: 'POST',
                    url: '{:url("User/del_address")}',
                    dataType: 'json',
                    data: {id: id},
                    success: function (data) {
                        layer.close(index);
                        if( data.result == 0 ){
                            layer.open({
                                content: data.msg//
                                ,yes: function(index, layero){
                                    layer.close(index);
                                    location.reload();
                                }
                            });
                        }else{
                            layer.open({
                                content: data.msg//
                                ,yes: function(index, layero){
                                    layer.close(index);
                                }
                            });
                        }
                    }
                });
            }
        });
    }


</script>
{/block}